package view
{
	/**
	 *
	 *@author CrazyChen 
	 *2013-4-20
	 */	
	import com.greensock.TweenLite;
	
	import flash.filters.GlowFilter;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	import manager.ObjectPool;
	
	import view.base.ClearView;
	
	public class EnergyPlusView extends ClearView
	{
		public function EnergyPlusView()
		{
			super();
			this.mouseChildren = false;
			this.mouseEnabled = false;
		}
		
		public function create(value:int,_x:int,_y:int):void{
			var tf:TextField = ObjectPool.getObj(TextField) as TextField;
			tf.defaultTextFormat = new TextFormat('宋体',24,0xffff33);
			tf.autoSize = TextFieldAutoSize.CENTER;
			this.addChild(tf);
			tf.text = "+"+value;
			tf.x  = _x-tf.width/2;
			tf.y = _y; 
			tf.filters = [new GlowFilter(0x000000,0.8,4,4,4)];
			TweenLite.to(tf, 3, {x:tf.x, y:_y-100,alpha:0,onComplete:complete,onCompleteParams:[tf]});
		}
		
		private function complete(tf:TextField):void{
			if(tf.parent){
				tf.parent.removeChild(tf);
			}
		}
	}
}